
import { lazy } from "react"  // 指令 在模块解析阶段执行 必须声明在文件顶部

const routerConfig = [
  {
    path: '/',
    component: lazy(() => import("@/views/layout")),
    children: [
      {
        path: "",
        meta: {
          title: '文章'
        },
        component: lazy(() => import('@/views/article')),
      },
      {
        path: "article",
        meta: {
          title: '文章'
        },
        component: lazy(() => import('@/views/article')),
      },
      {
        path: "archives",
        meta: {
          title: '归档'
        },
        component: lazy(() => import('@/views/archives'))
      },
      {
        path: "knowledge",
        meta: {
          title: '知识小册'
        },
        component: lazy(() => import('@/views/knowledge'))
      },
      {
        path: 'messageboard',
        meta: {
          title: "留言板"
        },
        component: lazy(() => import('@/views/messageboard')),
      },
      {
        path: 'into',
        meta: {
          title: "关于"
        },
        component: lazy(() => import('@/views/into')),
      },
      {
        path: "article/:id",
        meta: {
          title: '文章详情'
        },
        component: lazy(() => import('@/views/articleDetail'))
      },
      {
        path: "knowledge/:id",
        meta: {
          title: '文章详情'
        },
        component: lazy(() => import('@/views/knowledgeDetail'))
      },
      
      {
        path: "category/:params",
      
        component: lazy(() => import('@/views/article'))
      },
      {
        path: "category/Backend",
        meta: {
          title: '后端'
        },
        component: lazy(() => import('@/views/Backend'))
      },
      {
        path: "category/readings",
        meta: {
          title: '阅读'
        },
        component: lazy(() => import('@/views/readings'))
      },
      {
        path: "category/LeetCode",
        meta: {
          title: 'LeetCode'
        },
        component: lazy(() => import('@/views/LeetCode'))
      },
      {
        path: "category/news",
        meta: {
          title: '要闻'
        },
        component: lazy(() => import('@/views/news'))
      },
      {
        path: "category/bwsh",
        meta: {
          title: '八维'
        },
        component: lazy(() => import('@/views/bwsh'))
      },
      // {
      //   path: "category/12",
      //   meta: {
      //     title: '12'
      //   },
      //   component: lazy(() => import('@/views/12'))
      // },
    ]
  },
  {
    path: '*', //404页面
    meta: {
      title: '八维创作平台'
    },
    component: lazy(() => import("@/views/404"))
  },

]

export default {
  mode: 'history',
  routes: routerConfig
};

// import() 方法在脚本运行阶段执行，返回值是promise对象